
#include <bits/stdc++.h>
#define mp(a, b) make_pair(a, b)
using namespace std;

int box[110];
int main() {

  int n, q;
  cin >> n >> q;
  for (int i = 1; i <= q; i++) {
    int x;
    cin >> x;
    int pos = 1;
    if (x > 0) {
      pos = x;
    } else {
      pos = min_element(box + 1, box + n + 1) - box;
    }
    box[pos]++;
    cout << pos << " ";
  }

  return 0;
}